package com.mrjy.queries.dao;

import java.util.List;
import java.util.Map;

import com.mrjy.common.dto.QuestionCommentDto;
import com.mrjy.common.entity.QuestionInfo;
import com.mrjy.queries.dto.MiniMyQAQDTO;
import com.mrjy.queries.dto.PostDTO;
import com.mrjy.queries.dto.QuestionInfoDTO;

public interface IQuestionInfoDao {

	/**
	 * 查询用户的问题---按时间顺序
	 * @param questionInfo   id代替user_id检索用户本身的问题，user_id则检测问题是否被用户点赞
	 * @return
	 */
	List<QuestionInfo> queryQuestionListByTime(QuestionInfo questionInfo);
	/**
	 * 按照问题热度
	 * @param questionInfo
	 * @return
	 */
	List<QuestionInfo> queryQuestionListByHot(QuestionInfo questionInfo);
	
	
	/**
	 * 根据Id查找以及用户id
	 * @param questionInfo
	 * @return
	 */
	QuestionInfo queryById(QuestionInfo questionInfo);
		
	
	/**
	 * 添加
	 * @param question
	 * @return
	 */
	int insert(QuestionInfo question);
	
	
	/**
	 * 根据ID禁用、起用
	 * @param question
	 * @return
	 */
	int updateDisableFlag(QuestionInfo question);
	
	/**
	 * 后台查数据
	 * @param questionInfo
	 * @return
	 */
	List<QuestionInfo> queryQuestionListBack(QuestionInfo questionInfo);
	
	/**
	 * 后台统计问题总数
	 * @param question
	 * @return
	 */
	int countQuestionInfo(QuestionInfo question);
	
	/**
	 * 重置置顶状态
	 * @param id
	 * @return
	 */
	int resetStickStatus(int id);
	/**
	 * 置顶最前
	 * @param id
	 * @return
	 */
	int stickQuestion(int id);
	/**
	 * 问题评论数增加1
	 * @param id
	 * @return
	 */
	public int  addCommentNum(int id);
	
	/**
	 * 问题点赞数增加1
	 * @param id
	 * @return
	 */
	public int addGoodNum(int id);
	
	/**
	 * 根据ID修改
	 * @param question
	 * @return
	 */
	int updateById(QuestionInfo question);
	//分页查询
	List<QuestionInfo> queryPageQuestionInfo(QuestionInfo question);
	//根据ID删除
	int deleteByIds(int[] ids);
	List<QuestionInfo> getPageQuestionByContent(QuestionInfo question);
	Map countPageQuestionByContent(QuestionInfo question);
	
	/**
	 * 通过userId获取评论list
	 * @param info
	 * @return
	 */
	public List<QuestionInfo> queryCommentListByUserId(QuestionInfo info);
	/**
	 * 通过userId获取总评论数
	 * @param userId
	 * @return
	 */
	public int queryTotalCommentCountByUserId(int userId);
	/**
	 * 通过id查询问题信息
	 * @param id
	 * @return
	 */
	public QuestionInfo selectById(int id);

    List<QuestionInfo> queryPageNewestQuestion(QuestionInfo info);

    public List<QuestionCommentDto> queryMyQAPageByUserId(QuestionInfo info);

    List<QuestionInfo> queryPageByViewNum(QuestionInfo info);
	
	public int addQuestionViewNum(Integer qid);
	
	int countByTypeId(QuestionInfo info);
	
	int countNewestQuestion(QuestionInfo info);
	
	QuestionInfo queryExistQuestionByTopicId(QuestionInfo info);
	
	public List<QuestionInfo> selectQuestionListPage(QuestionInfo info);
	
	List<QuestionInfo> queryMyQuestionByUserId(QuestionInfo info);

    int countMyQuestionByUserId(QuestionInfo info);
	
	/**
	 * 通过问题话题类型查询用户的相关信息
	 * @param info
	 * @return
	 */
	public List<QuestionInfo> queryFamilyQuestionUserInfoForPC(QuestionInfo info);
	List<QuestionCommentDto> queryNewQuestion(QuestionInfo info);
	List<QuestionInfo> queryIntelligent(QuestionInfo info);

    /**
     * 添加
     *
     * @param question
     * @return
     */
    int insertAndGetId(QuestionInfo question);

    List<QuestionCommentDto> queryNewRecordQuestion(QuestionInfo info);

    List<QuestionCommentDto> queryDynamicPageByInfo(QuestionInfo info);


    int countDynamicPageByInfo(QuestionInfo info);

    List<QuestionCommentDto> getPageSearchQuestionByContent(QuestionInfo info);

    Map countSearchQuestionByContent(QuestionInfo info);

    List<QuestionCommentDto> queryUserDynamicPageByInfo(QuestionInfo info);

    int countUserDynamicPageByInfo(QuestionInfo info);
	int insertquestionLabel(int questionId);

    List<QuestionCommentDto> queryTopicPageByInfo(QuestionInfo info);
    
    int countTopicPageByInfo(QuestionInfo info);

    List<QuestionInfo> queryTopicIntelligent(QuestionInfo info);
    
    int countTopicIntelligent(QuestionInfo info);

    List<QuestionInfo> relatedQuestions(QuestionInfo info);

    int countMyQAPageByUserId(QuestionInfo info);
    
    List<QuestionInfo> queryListForImportSolr(QuestionInfo info);
    
	List<MiniMyQAQDTO> miniMyQAQ(MiniMyQAQDTO info);
	
	List<PostDTO> queryPostPage(QuestionInfo info);
	List<QuestionInfoDTO> latestByTypes(Integer[] types);
}
